/**
 * Handle changed data.
 *
 * @param {Object} oldValue old value
 * @param {Object} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"4156BF8D-18AD-4C2A-A07E-C94DBB83C91E"}
 */
function onDataChangeCuit(oldValue, newValue, event) {

	var query 	= 'select proveedor_id, razon_social from proveedor where cuit = ? and es_fletero = 0'
	var args 	= [newValue]
	var max 	= 1
	
	var $ds 	= databaseManager.getDataSetByQuery('infocom',query,args,max)
	
	if ($ds.getMaxRowIndex() != 0)
	{
		globals.DIALOGS.showErrorDialog('Error',  'CUIT Duplicado: ' + $ds.getValue(1,2),  "OK")
		return false
	}

	return true
}
